Skip to content

Client keeps the caller's headers; restate.ext.pydantic imports without the MCP extra - #307

Merged
igalshilman merged 2 commits into
mainfrom
cherry-picks
Nov 9, 2026
Merged

igalshilman merged 2 commits into
mainfrom
cherry-picks

Conversation

@igalshilman

@igalshilman igalshilman commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Two community fixes, cherry-picked with their authorship kept.

Tested locally:

  • Headers: one dict reused for a text and a binary handler against a real Restate server (fails with HTTP 400 on main); tests/client_headers.py passes.
  • MCP: in a clean virtualenv with only the pydantic_ai extra, restate.ext.pydantic imports on this branch and fails on main; with pydantic-ai-slim[mcp] added, an MCPToolset is still wrapped as RestateMCPToolset.
  • The in-process tests pass (356).

Closes #298, #257, #246.

mkzung and others added 2 commits November 9, 2026 18:07
…p extra

_toolset.py imported pydantic_ai.mcp at module level, so importing
restate.ext.pydantic failed unless pydantic-ai-slim[mcp] was installed,
although _agent.py already treats MCP support as optional. Move
RestateMCPToolset into its own module that is only imported lazily.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

I reviewed both cherry-picked fixes, and checked each one against the base locally.

  • Client no longer mutates the caller's headers: do_call now copies the dict before adding Content-Type, and it finds a caller's override in any letter case. tests/client_headers.py covers no override plus three casings, checks that the caller's dict is unchanged, and passes locally (4 tests).
  • restate.ext.pydantic imports without the MCP extra: RestateMCPToolset and its result types move unchanged to _mcp_toolset.py, which is imported only inside the existing try/except ImportError in set_context. In a .venv without pydantic-ai-slim[mcp], the base _toolset.py fails on its top-level pydantic_ai.mcp import, while import restate.ext.pydantic succeeds on this branch. Nothing else references the moved symbols, and ruff check and format are clean.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Test Results

  8 files  ±0    8 suites  ±0   3m 54s ⏱️ +9s
 71 tests ±0   71 ✅ ±0  0 💤 ±0  0 ❌ ±0 
322 runs  ±0  322 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 50cf9bf. ± Comparison against base commit 8339bbe.

@igalshilman
igalshilman merged commit aba03f7 into main Nov 9, 2026
11 of 12 checks passed
@igalshilman
igalshilman deleted the cherry-picks branch November 9, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants